package vivace.view;

import java.awt.*;
import javax.swing.*;
import javax.sound.midi.*;

import vivace.helper.GUIHelper;

public class TrackBar extends JPanel {

	private String name;
	private int index, width, height;

	public int getIndex(){
		return index;
	}
	
	public void setWidth(int width){
		this.width = width;
		this.setPreferredSize(new Dimension(width,this.height));
		repaint();
	}

	public TrackBar( int index, String name ){
		this.setOpaque(false);
		this.index = index;
		this.name = name;
		this.height = GUIHelper.TRACK_HEIGHT;
	}
	
	public void paintComponent(Graphics g){
		super.paintComponent(g);
		g.setColor(Color.RED);
		g.fill3DRect(0, 1, this.width, this.height, true);
		g.setColor(Color.BLACK);
		g.drawString(this.name,5,(int) Math.ceil(this.height/2) + 4 );
	}
	
	public void setPosition( int x, int y ){
		setBounds(x,y,this.width,this.height);
	}
	
}
